home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-20 | 4.3 KB | 146 lines | [TEXT/KAHL] |
- //=============================================================================
- // Little Smalltalk, version 3
- // Written by Tim Budd, Oregon State University, July 1988
- //
- // Symantec Think Class Library interface code
- // ©Julian Barkway, April 1994, all rights reserved.
- //
- // CLStDoc.cp
- // ----------
- // This class provides basic document related functions.
- //
- //
- // Version History
- // ---------------
- // 3.1.4 - First general release
- // 3.1.5 - Modified to allow specification of non-closeable windows
- //=============================================================================
-
- #include <string.h>
- #include "Global.h"
- #include "Commands.h"
- #include "CApplication.h"
- #include "CBartender.h"
- #include "CDataFile.h"
- #include "CDecorator.h"
- #include "CDesktop.h"
- #include "CError.h"
- #include "CPanorama.h"
- #include "TBUtilities.h"
- #include "CLStDoc.h"
- #include "CTextPane.h"
- #include "CLStWindow.h"
- #include "CLStApp.h"
- #include "LStResources.h"
-
- #define LSTWIN_MIN 75
-
- extern CApplication *gApplication; /* The application */
- extern CBartender *gBartender; /* The menu handling object */
- extern CDecorator *gDecorator; /* Window dressing object */
- extern CDesktop *gDesktop; /* The enclosure for all windows */
- extern CBureaucrat *gGopher; /* The current boss in the chain of command */
- extern OSType gSignature; /* The application's signature */
- extern CError *gError; /* The error handling object */
-
- extern CLStApp *gSmalltalk;
-
-
- //==============================================================================
- // Initialise a Document object.
- //==============================================================================
- void CLStDoc::ILStDoc (CApplication *super, Boolean printable)
- {
- CDocument::IDocument (super, printable);
- }
-
-
- //==============================================================================
- // Make a window.
- // Amended 10.3.95 for v3.1.5 to allow specification of non-closeable windows.
- //==============================================================================
- CWindow *CLStDoc::BuildWindow (char *title,
- Point *wPosition, Point *wSize, Boolean noClose)
- {
- Str255 wTitle;
- Rect sr;
-
- itsWindow = new (CLStWindow);
-
- if (noClose) {
- Rect bounds = {100, 100, 100, 100}; /* We'll do proper sizing and positioning later */
- itsWindow->INewWindow (&bounds, FALSE, 0, FALSE, FALSE, gDesktop, this);
- }
- else
- itsWindow->IWindow (WTemplate, FALSE, gDesktop, this);
-
- if (title != NULL) {
- strcpy ((char *)wTitle, title);
- CtoPstr ((char *)wTitle);
- itsWindow->SetTitle (wTitle);
- }
-
- SetRect (&sr, LSTWIN_MIN, LSTWIN_MIN,
- screenBits.bounds.right, screenBits.bounds.bottom);
- itsWindow->SetSizeRect (&sr);
-
- gDecorator->PlaceNewWindow (itsWindow);
-
- if (wPosition != NULL)
- itsWindow->Move (wPosition->h, wPosition->v);
-
- if (wSize != NULL)
- itsWindow->ChangeSize (wSize->h, wSize->v);
-
- itsWindow->Select ();
- ((CLStWindow *)itsWindow)->itsDocument = this;
- return itsWindow;
- }
-
-
- //==============================================================================
- // Set the file type for this document. Allows specification of types other than
- // 'TEXT'
- //==============================================================================
- void CLStDoc::SetFileType (long fType)
- {
- fileType = fType;
- }
-
-
- //==============================================================================
- // Return the document's window.
- //==============================================================================
- CWindow *CLStDoc::GetWindow (void)
- {
- return itsMainPane->GetWindow ();
- }
-
-
- //==============================================================================
- // Process the standard file requester.
- //==============================================================================
- void CLStDoc::AskFileName (char *promptString, Boolean save, StandardFileReply *sfReply,
- SFTypeList fTypes, short numFTypes)
- {
- Point location;
- Str255 str;
-
- if (save) {
- strcpy ((char *)str, promptString);
- CtoPstr ((char *)str);
- StandardPutFile (str, "\p", sfReply);
- }
- else
- StandardGetFile (NULL, numFTypes, fTypes, sfReply);
- }
-
-
- //={OVERRIDE}==================================================================
- // Close confirmation handled by Smalltalk.
- //=============================================================================
- Boolean CLStDoc::ConfirmClose (Boolean quitting)
- {
- return TRUE;
- }
-